export default function Singleton<T>() {
    class Singleton {
        private static _instance: any = null;

        public static get instance() : T {
            if((<any>this)._instance == null){
                (<any>this)._instance = new (<any>this)();
            }
            return (<any>this)._instance;
        }

        constructor(){

        }

        public release(){
            (<any>this)._instance = null;
        }

    }

    return Singleton;
}
